//
//	MiscTeeConnector.m -- an IBConnector that allows a multitude of connections
//						  to spread out from it.
//
//		Written by David Fedchenko.  Copyright 1994 by David Fedchenko.
//				Version 1.0  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This object is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	

#import "MiscTeeConnector.h"
#import "MiscTee.h"

@implementation MiscTeeConnector

- setSource:anObject
    {
    idSource = anObject;

    return self;
    }

- setDestination:anObject
    {
    idDest = anObject;

    return self;
    }

- setAction:(SEL)anAction
	{
	selAction = anAction;
	
	return self;
	}

- source
    {
    return idSource;
    }

- destination
    {
    return idDest;
    }

-(SEL) action
	{
	return selAction;
	}

- establishConnection
    {
    [idSource addConnection:idDest with:selAction];

    return self;
    }

- nibInstantiate
    {
    idSource = [idSource nibInstantiate];
    idDest = [idDest nibInstantiate];
	
    return self;
    }

- renewObject:old to:new
    {
    if (old == idSource)
        {
		idSource = new;
        }
    else if (old == idDest)
        {
		idDest = new;
        }

    return self;
    }

- read:(NXTypedStream *)stream
    {
    [super read:stream];
	
	NXReadType(stream, ":", &selAction);
    idSource = NXReadObject(stream);
    idDest = NXReadObject(stream);

    return self;
    }

- write:(NXTypedStream *)stream
    {
    [super write:stream];

	NXWriteType(stream, ":", &selAction);
    NXWriteObject(stream, idSource);
    NXWriteObject(stream, idDest);

    return self;
    }

- free
    {
    return [super free];
    }

@end
